<template>
  <zero-dialog :showDialog.sync="dialog.open" :width="dialog.width" :title="dialog.title"
               :fullscreen.sync="dialog.fullscreen" :id="dialog.id"
               :submit="submitForm">
    <div slot="body">
      <vxe-form :ref="form.ref" :data="form.info" :rules="form.rules" title-align="right" title-width="100">
        <vxe-form-item title="生成的文件" field="name" span="24" :item-render="{}">
          <template #default="{ data }">
            <vxe-input max-length="50" v-model="data.name" showWordCount clearable placeholder="请输入生成的文件"/>
          </template>
        </vxe-form-item>
        <vxe-form-item title="分组编码" field="groupCode" span="24" :item-render="{}">
          <template #default="{ data }">
            <vxe-input max-length="10" v-model="data.groupCode" clearable placeholder="请输入分组编码"/>
          </template>
        </vxe-form-item>
        <vxe-form-item title="占位路径" field="occupationPath" span="24" :item-render="{}"
                       :title-prefix='{ content: "文件生成后的路径，比如：/zero/{}/mapper，其中{}为包的占位符 ", icon: "vxe-icon-question-circle-fill" }'>
          <template #default="{ data }">
            <vxe-input max-length="50" v-model="data.occupationPath" showWordCount clearable
                       placeholder="请输入占位路径"/>
          </template>
        </vxe-form-item>
        <vxe-form-item title="备注" field="remarks" span="24" :item-render="{}">
          <template #default="{ data }">
            <vxe-textarea maxlength="255" v-model="data.remarks" showWordCount clearable placeholder="请输入备注"
                          rows="6"/>
          </template>
        </vxe-form-item>
      </vxe-form>
    </div>
  </zero-dialog>
</template>


<script>
import addUpdate from '@/mixins/add-update.js';

export default {
  name: 'addUpdateForm',
  mixins: [addUpdate],
  data() {
    return {
      axios: this.$axiosGen, // 请求的微服务，默认授权服务
      addUrl: "/templateInfo",
      updateUrl: "/templateInfo",
      // byIdUrl: "/templateInfo",
      dialog: {
        width: '800px', //定义宽度
      },
      form: {//表单数据
        rules: { //表单验证
          name: [{required: true, message: "名称不能为空", trigger: "blur"}],
          groupCode: [{required: true, message: "分组编码不能为空", trigger: "blur"}],
          occupationPath: [{required: true, message: "占位路径不能为空", trigger: "blur"}]
        }
      }
    }
  }
}
</script>
